import request from '@/utils/request'
const api_name = '/admin/product'
export default {
    // GET /admin/product/{page}/{limit}
    getSpuByPage(page, limit,category3Id){
        return request({
            url: `${api_name}/${page}/${limit}`,
            method: 'GET',
            params:{
                category3Id
            }
        })
    },
    //GET /admin/product/baseSaleAttrList
    getbaseSaleAttrList(){
        return request({
            url: `${api_name}/baseSaleAttrList`,
            method: 'GET',
        })
    },
    //GET /admin/product/getSpuById/{spuId}
    //获取spu详情
    getSpuInfo(spuId){
        return request({
            url: `${api_name}/getSpuById/${spuId}`,
            method: 'GET',
        })
    },
    //GET /admin/product/spuImageList/{spuId}
    //获取图片列表
    getspuImageList(spuId){
        return request({
            url: `${api_name}/spuImageList/${spuId}`,
            method: 'GET',
        })
    },
    //POST /admin/product/saveSpuInfo
    //POST /admin/product/updateSpuInfo
    //新增或更新
    addOrUpdate(spuInfo){
        return request({
            url: `${api_name}/${spuInfo.id? 'updateSpuInfo':'saveSpuInfo'}`,
            method: 'POST',
            data:spuInfo
        })
    },
    //DELETE /admin/product/deleteSpu/{spuId}
    deleteSpu(spuId){
        return request({
            url: `${api_name}/deleteSpu/${spuId}`,
            method: 'DELETE',
        })
    }
}